package hari2.latihan;
import java.io.*;

public class Stream2 {
	private static byte[] getInput() throws Exception {
		System.out.println("Enter some character: ");
		byte[] buffer = new byte[12];
		for (int i = 0; i < 12; i++) 
			buffer[i] = (byte) System.in.read();
		return buffer;
		
	}
	
	public static void main(String[] args) throws Exception {
		byte buf[] = getInput();
		OutputStream f0 = new FileOutputStream("src/hari2/latihan/file1.txt");
		OutputStream f1 = new FileOutputStream("src/hari2/latihan/file2.txt");
		OutputStream f2 = new FileOutputStream("src/hari2/latihan/file3.txt");
		
		for (int i = 0; i < buf.length; i++) {f0.write(buf[i]);}
		f0.close();
		f1.write(buf); f1.close();
		f2.write(buf, (buf.length)/4, (buf.length)/2);
		f2.close();
		
	}

	
}
